package com.heima.article.controller.v1;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.article.service.ApArticleService;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/article")
@Api(value = "查询文章信息")
public class ApArticleController {

    @Autowired
    ApArticleService articleService;

    @PostMapping("/findById/{articleId}")
    public ResponseResult<ApArticle> findByArticleId(@RequestParam("articleId") Long articleId ){
        ApArticle one = articleService.getOne(Wrappers.<ApArticle>lambdaQuery().eq(ApArticle::getId, articleId));
        return ResponseResult.okResult(one);
    }

}
